package com.servicesystem.servicesystem.controller.ali;

import com.servicesystem.servicesystem.service.ali.SelectGoodsService;
import com.servicesystem.servicesystem.untis.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("select-goods")
public class SelectGoodsController {

    @Autowired
    private SelectGoodsService selectGoodsService;

    /**
     * 获取选品库的组
     *
     * @param current
     * @return
     */
    @PostMapping("get-select-goods-group/{current}")
    public R getSelectGoodsGroup(@PathVariable Long current) {
        try {
            return selectGoodsService.getSelectGoodsGroup(current);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return R.fail("获取失败");
    }

    /**
     * 获取选品库的列表
     *
     * @param current
     * @return
     */
    @PostMapping("get-select-goods-list/{current}/{groupId}")
    public R getSelectGoods(@PathVariable Long current, @PathVariable String groupId) {
        try {
            return selectGoodsService.getSelectGoods(current, groupId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return R.fail("获取失败");
    }
}
